
// cache some key ajax GET requests, etc, columns.php, feed.php
// 注意：这里的get不是通常那个动词，而是指http的get请求
(function(window) {
    window.getCacher = {
        getCache: function(key) {
            return $apix.getStorage(this._makeKey(key));
        },
        hasCache: function(key) {
            return obj_being(this.getCache(key));
        },

        cache: function(key, json) {
            var k = this._makeKey(key);
            $apix.setStorage(k, json);
            this._keyMap.addKey(k);
        },

        rmCache: function(key) {
            if (this.hasCache(key)) {
                var k = this._makeKey(key);
                $apix.rmStorage(k);
                this._keyMap.rmKey(k);
            }
        },
        clear: function() {
            this._keyMap.clearStorage();
        },

        _makeKey: function(key) {
            var gid = $apix.getStorage('gid');
            return 'get-cacher-' + key + gid;
        },
        _keyMap: new StorageKeyMap('get-cacher'),
    };

	function _log(o) {
		f_log('getCacher', o);
	}
	function _wlog(o) {
		f_wlog('getCacher', o);
	}
})(window);
